import { SwaggerRouter } from 'koa-swagger-decorator';
import path from 'path';
import routerName from '@/config/router';

const swaggerRouter = new SwaggerRouter();

// router.prefix(routerName);

swaggerRouter.swagger({
  title: 'A project',
  description: 'Api doc',
  version: '1.0.0',

  prefix: routerName,

  swaggerHtmlEndpoint: `${routerName}/swagger`,

  swaggerJsonEndpoint: `/api-doc`,
});

swaggerRouter.mapDir(path.resolve(__dirname, '../controller/'));

swaggerRouter.dumpSwaggerJson({
  filename: 'swagger.json',
  dir: process.cwd(),
});

export default swaggerRouter;
